<template>
    <div class="container">
      <!-- 题目审核弹框 -->
      <el-dialog title="题目审核" :visible="showDialogs" @close="close" width="30%">
      <el-form :model="data">
          <el-form-item prop="chkState">
            <el-radio v-model="data.chkState" :label="1">通过</el-radio>
            <el-radio v-model="data.chkState" :label="2">拒绝</el-radio>
          </el-form-item>
          <el-form-item prop="chkRemarks">
            <el-input
              ref="data"
              v-model="data.chkRemarks"
              size="small"
              style="margin-bottom: 16px;"
              type="textarea"
              :rows="2"
              placeholder="请输入审核意见"
              />
          </el-form-item>
          <el-form-item>
            <el-row type="flex" justify="end">
              <el-col :span="10">
                <el-button @click="close">取消</el-button>
                <el-button type="primary" @click="OkBtn">确认</el-button>
              </el-col>
            </el-row>
          </el-form-item>
        </el-form>
        <!-- <el-button :plain="true" @click="open3">警告</el-button> -->
      </el-dialog>
    </div>
  </template>

<script>
import { choiceCheck } from '@/api/hmmm/questions'
export default {
  props: {
    showDialogs: {
      type: Boolean,
      default: false
    },
    auditOpinionsId: {
      type: Number,
      default: null
    }
  },
  data () {
    return {
      radio: '1',
      data: {
        chkRemarks: '',
        chkState: 2
      }
    }
  },
  methods: {
    // 取消
    close () {
      this.$emit('update:showDialogs', false)
      this.data = {
        chkRemarks: '',
        chkState: 2
      }
    },
    // 确认
    async OkBtn () {
      if (this.$refs.data.value === '') {
        this.$message({
          message: '请输入审核意见',
          type: 'warning'
        })
      } else {
        await choiceCheck({
          ...this.data,
          id: this.auditOpinionsId
        })
        this.close()
        this.$emit('refrech')
        this.$message.success('操作成功')
      }
    }
  }
}
</script>

<style scoped lang='scss'>
.el-form-item #el-input{
border-color: #ccc;
}
</style>
